package com.example.smartcity_poverty.ui.AllService.TakeOutTr.adapter

import androidx.annotation.LayoutRes
import com.example.smartcity_poverty.App
import com.example.smartcity_poverty.App.Companion.url
import com.example.smartcity_poverty.Base.BaseRecyclerAdapter
import com.example.smartcity_poverty.R
import com.example.smartcity_poverty.logic.model.TakeOutModel.ToServiceModel
import com.example.smartcity_poverty.logic.util.Util.glide
import kotlinx.android.synthetic.main.re_item_more.*

/**
 *  ANDROID STUDIO -VERSION 4.0
 *  email: 2506789532@qq.com
 *  CodeAuthor： Ikun
 *
 *  explain: 外卖主页-外卖主题分类列表适配器
 **/
class ToServiceAdapter(
    val list: ArrayList<ToServiceModel.Data>,
    @LayoutRes
    val layoutId: Int
) : BaseRecyclerAdapter<ToServiceModel.Data>(list, R.layout.re_item_more) {
    override fun setData(
        view: BaseViewHolder.ViewFind,
        data: ToServiceModel.Data,
        position: Int,
        holder: BaseViewHolder
    ) {
        // 设置动画
        holder.itemView.animation = App.getAnimationBottomAndTop()

        // 填充数据
        list[position].apply {
            // 填充图片
            glide(url + this.imgUrl, holder.viewFind.moreImage)
            // 填充文本
            holder.viewFind.moreTitle.text = this.themeName
        }
    }
}